package com.ly.ocw.repository;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.ly.ocw.entity.CrmMember;

/**
 * 通过@MapperScannerConfigurer扫描目录中的所有接口, 动态在Spring Context中生成实现.
 * 方法名称必须与Mapper.xml中保持一致.
 * 
 * @author peter
 */
@MyBatisRepository
public interface CrmMemberDao {
	
	CrmMember getById(Long id);
	
	List<CrmMember> getAll();
	
	/**
	 * 分页查询
	 * @param overtime
	 * @param pageStart
	 * @param pageSize
	 * @return
	 */
	List<CrmMember> searchPage(@Param("crmMember")CrmMember crmMember,@Param("pageStart")int pageStart,@Param("pageSize")int pageSize);
	
	/**
	 * 分页查询总记录数
	 * @param overtime
	 * @return
	 */
	Long searchCount(CrmMember crmMember);
	
	void save(CrmMember crmMember);
	
	void update(CrmMember crmMember);
	
	/**
	 * 软删除
	 */
	void delete(Long id);

	CrmMember getByCardIdAndCodeAndOpenid(@Param("cardId")String cardId, @Param("cardNumber")String cardNumber, @Param("openid")String openid);

	CrmMember getByCardIdAndCode(@Param("cardId")String cardId, @Param("cardNumber")String cardNumber);

	CrmMember getByCardIdAndOpenid(@Param("cardId")String cardId, @Param("openid")String openid);

	CrmMember getByCardIdAndMobile(@Param("cardId")String cardId, @Param("mobilePhone")String mobilePhone);
	
}
